<script setup>
defineProps({
  content: {
    type: String,
    required: true,
    default: '',
  },
})
</script>

<template>
  <div class="html-preview" v-html="content"></div>
</template>

<style lang="scss" scoped>
.html-preview {
  width: 100%;
  height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 10px;

  :deep(h1) {
    font-size: 2em;
    font-weight: bold;
    margin-top: 0.67em;
    margin-bottom: 0.67em;
  }
  :deep(h2) {
    font-size: 1.5em;
    font-weight: bold;
    margin-top: 0.83em;
    margin-bottom: 0.83em;
  }
  :deep(h3) {
    font-size: 1.17em;
    font-weight: bold;
    margin-top: 1em;
    margin-bottom: 1em;
  }
  :deep(h4) {
    font-size: 1em;
    font-weight: bold;
    margin-top: 1.33em;
    margin-bottom: 1.33em;
  }
  :deep(h5) {
    font-size: 0.83em;
    font-weight: bold;
    margin-top: 1.67em;
    margin-bottom: 1.67em;
  }
  :deep(h6) {
    font-size: 0.67em;
    font-weight: bold;
    margin-top: 2.33em;
    margin-bottom: 2.33em;
  }
  :deep(p) {
    margin-top: 1em;
    margin-bottom: 1em;
  }
  :deep(ul),
  :deep(ol) {
    padding-left: 2em;
    margin-top: 1em;
    margin-bottom: 1em;
  }
  :deep(ul) {
    list-style-type: disc;
  }
  :deep(ol) {
    list-style-type: decimal;
  }
  :deep(li) {
    display: list-item;
  }
  :deep(blockquote) {
    margin: 1em 40px;
    padding-left: 1em;
    border-left: 4px solid #ccc;
  }
  :deep(img) {
    max-width: 100%;
    height: auto;
  }
}
</style>
